<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
	<title>DNS缓存设置 | ElasticSearch 7.7 权威指南中文版</title>
	<meta name="keywords" content="ElasticSearch 权威指南中文版, elasticsearch 7, es7, 实时数据分析，实时数据检索" />
    <meta name="description" content="ElasticSearch 权威指南中文版, elasticsearch 7, es7, 实时数据分析，实时数据检索" />
    <!-- Give IE8 a fighting chance -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
	<link rel="stylesheet" type="text/css" href="../static/styles.css" />
	<script>
	var _link = 'networkaddress-cache-ttl.html';
    </script>
</head>
<body>
<div class="main-container">
    <section id="content">
        <div class="content-wrapper">
            <section id="guide" lang="zh_cn">
                <div class="container">
                    <div class="row">
                        <div class="col-xs-12 col-sm-8 col-md-8 guide-section">
                            <div style="color:gray; word-break: break-all; font-size:12px;">原英文版地址: <a href="https://www.elastic.co/guide/en/elasticsearch/reference/7.7/networkaddress-cache-ttl.html" rel="nofollow" target="_blank">https://www.elastic.co/guide/en/elasticsearch/reference/7.7/networkaddress-cache-ttl.html</a>, 原文档版权归 www.elastic.co 所有<br/>本地英文版地址: <a href="../en/networkaddress-cache-ttl.html" rel="nofollow" target="_blank">../en/networkaddress-cache-ttl.html</a></div>
                        <!-- start body -->
                  <div class="page_header">
<strong>重要</strong>: 此版本不会发布额外的bug修复或文档更新。最新信息请参考 <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html" rel="nofollow">当前版本文档</a>。
</div>
<div id="content">
<div class="breadcrumbs">
<span class="breadcrumb-link"><a href="index.html">Elasticsearch 权威指南 [7.7]</a></span>
»
<span class="breadcrumb-link"><a href="setup.html">安装和设置</a></span>
»
<span class="breadcrumb-link"><a href="system-config.html">重要的系统配置</a></span>
»
<span class="breadcrumb-node">DNS缓存设置</span>
</div>
<div class="navheader">
<span class="prev">
<a href="max-number-of-threads.html">« 线程数量</a>
</span>
<span class="next">
<a href="executable-jna-tmpdir.html">不使用<code class="literal">noexec</code>挂载JNA临时目录 »</a>
</span>
</div>
<div class="section">
<div class="titlepage"><div><div>
<h2 class="title">
<a id="networkaddress-cache-ttl"></a>DNS缓存设置 (DNS cache settings)
</h2>
</div></div></div>
<p>
Elasticsearch运行时有一个安全管理器。
有了安全管理器后，JVM默认会无限期地缓存正向的主机名解析，而反向的主机名解析默认只会缓存10秒。
Elasticsearch 用默认值覆盖这种行为，将正向查找缓存60秒，反向查找缓存10秒。
这些值应该适用于大多数环境，包括 DNS 解析随时间变化的环境。
如果没有，可以在 <a class="xref" href="jvm-options.html" title="Setting JVM options">JVM 选项</a> 中修改 <code class="literal">es.networkaddress.cache.ttl</code> 和 <code class="literal">es.networkaddress.cache.negative.ttl</code> 。

请注意，<a href="http://docs.oracle.com/javase/8/docs/technotes/guides/security/PolicyFiles.html" class="ulink" target="_top">Java 安全策略</a> 中的 <a href="http://docs.oracle.com/javase/8/docs/technotes/guides/net/properties.html" class="ulink" target="_top"><code class="literal">networkaddress.cache.ttl=&lt;timeout&gt;</code></a> 和 <a href="http://docs.oracle.com/javase/8/docs/technotes/guides/net/properties.html" class="ulink" target="_top"><code class="literal">networkaddress.cache.negative.ttl=&lt;timeout&gt;</code></a> 的值被 Elasticsearch 忽略，除非你删除 <code class="literal">es.networkaddress.cache.ttl</code> 和 <code class="literal">es.networkaddress.cache.negative.ttl</code> 设置。
</p>
</div>
<div class="navfooter">
<span class="prev">
<a href="max-number-of-threads.html">« 线程数量</a>
</span>
<span class="next">
<a href="executable-jna-tmpdir.html">不使用<code class="literal">noexec</code>挂载JNA临时目录 »</a>
</span>
</div>
</div>

                  <!-- end body -->
                        </div>
                        <div class="col-xs-12 col-sm-4 col-md-4" id="right_col">
                        
                        </div>
                    </div>
                </div>
            </section>
        </div>
    </section>
</div>
<script src="../static/cn.js"></script>
</body>
</html>